package cn.iocoder.yudao.framework.business.captcha.controller;

import cn.iocoder.yudao.framework.business.captcha.pojo.vo.LegacyCaptchaVO;
import cn.iocoder.yudao.framework.business.captcha.service.LegacyCaptchaService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "图形验证码")
@RestController
@RequestMapping("/captcha")
@Validated
public class LegacyCaptchaController {

    @Resource
    private LegacyCaptchaService legacyCaptchaService;

    @GetMapping("/generate")
    @Operation(summary = "获取图形验证码")
    @PermitAll
    public CommonResult<LegacyCaptchaVO> generate() {
        return CommonResult.success(legacyCaptchaService.generate());
    }

}
